#include "aicommandcallreponse.h"

namespace IAlib
{

AiCommandCallReponse::AiCommandCallReponse()
{
    AiCommand::setType(COMMAND_CALL_RESPONSE);
}

QByteArray AiCommandCallReponse::toByteArray() const
{
    QByteArray byte_array;
    QDataStream data(&byte_array, QIODevice::WriteOnly);

    data<<getMode();
    data<<getNumOrigine();
    data<<getNumTarget();
    data<<getIdOrigine();
    data<<getDialogueId();
    data<<getReponseStatus();

    return byte_array;
}

void AiCommandCallReponse::fromByteArray(QByteArray &byte_array)
{
    QDataStream data(&byte_array, QIODevice::ReadOnly);
    int i_temp;
    QString s_temp;
    data>>i_temp;
    setMode((AiCommand::CommandMode)i_temp);
    data>>s_temp;
    setNumOrigine(s_temp);
    data>>s_temp;
    setNumTarget(s_temp);
    data>>s_temp;
    setIdOrigine(s_temp);
    data>>m_dialogue_id;
    data>>m_reponse_status;
}

}
